package com.code.leetcode.offer;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/7/31 9:49
 */
public class The15 {
    public int hammingWeight(int n) {
        int sum = 0;
        while (n != 0) {
            n = n & (n - 1);
            sum++;
        }
        return sum;
    }

    public static void main(String[] args) {
        The15 the15 = new The15();
        System.out.println(the15.hammingWeight(-1));
    }
}
